﻿namespace jzgl.Windows
{
    using jzgl.Controller;
    using jzgl.Model;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text.RegularExpressions;
    using System.Windows.Forms;

    public class BudgetInfo : Form
    {
        private BudgetBargainDB barDB;
        private BudgetBargainDB bargainDb;
        private Button btn_Cancel;
        private Button btn_Save;
        private BudgetListDB budgetDb;
        private BudgetDetailsDB budgetDetailsDb;
        private string budgetId;
        private BudgetInfoDB budgetInfoDb;
        private CheckBox chk_QianHeTong;
        private ComboBox combox_Designer;
        private ComboBox combox_DesStyle;
        private IContainer components;
        private DateTimePicker dateTimePicker1;
        private DateTimePicker dateTimePicker2;
        private DateTimePicker dateTimePicker3;
        private DateTimePicker dateTimePicker4;
        private DesignerDB designerDB;
        private BudgetDetailsDB detailsDB;
        private CustFromDB fromDB;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private BudgetInfoDB infoDB;
        private int k;
        public static string key = "";
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label14;
        private Label label15;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        public static List<jzgl.Model.BudgetInfo> list = new List<jzgl.Model.BudgetInfo>();
        public static List<BudgetDetails> listBudgetDetails = new List<BudgetDetails>();
        private BudgetListDB listDB;
        private Panel panel1;
        private DesStyleDB styleDB;
        private int t;
        private DataTable table;
        private TextBox txt_Address;
        private TextBox txt_BianHao;
        private TextBox txt_Customer_Name;
        private TextBox txt_Dingjin;
        private TextBox txt_HouseArea;
        private TextBox txt_HouseType;
        private TextBox txt_Phone;
        private TextBox txt_ShouFu;
        private TextBox txt_YaoQiu;
        private TextBox txt_ZaoJia;
        private TextBox txtCustomerFrom;
        private MaterTypeDB typeDB;
        private SysUserDB user;
        private string user_id;

        public BudgetInfo()
        {
            this.components = null;
            this.typeDB = new MaterTypeDB();
            this.fromDB = new CustFromDB();
            this.designerDB = new DesignerDB();
            this.styleDB = new DesStyleDB();
            this.budgetDb = new BudgetListDB();
            this.bargainDb = new BudgetBargainDB();
            this.budgetInfoDb = new BudgetInfoDB();
            this.budgetDetailsDb = new BudgetDetailsDB();
            this.listDB = new BudgetListDB();
            this.infoDB = new BudgetInfoDB();
            this.barDB = new BudgetBargainDB();
            this.detailsDB = new BudgetDetailsDB();
            this.user = new SysUserDB();
            this.table = null;
            this.budgetId = "";
            this.user_id = "";
            this.t = 0;
            this.k = 0;
            this.InitializeComponent();
            this.t = 0;
        }

        public BudgetInfo(string bud_id, string u)
        {
            this.components = null;
            this.typeDB = new MaterTypeDB();
            this.fromDB = new CustFromDB();
            this.designerDB = new DesignerDB();
            this.styleDB = new DesStyleDB();
            this.budgetDb = new BudgetListDB();
            this.bargainDb = new BudgetBargainDB();
            this.budgetInfoDb = new BudgetInfoDB();
            this.budgetDetailsDb = new BudgetDetailsDB();
            this.listDB = new BudgetListDB();
            this.infoDB = new BudgetInfoDB();
            this.barDB = new BudgetBargainDB();
            this.detailsDB = new BudgetDetailsDB();
            this.user = new SysUserDB();
            this.table = null;
            this.budgetId = "";
            this.user_id = "";
            this.t = 0;
            this.k = 0;
            this.InitializeComponent();
            this.user_id = u;
            this.budgetId = bud_id;
            this.table = this.user.Show_SysUser(this.user_id);
            if (this.table.Rows.Count > 0)
            {
                if (this.table.Rows[0][4].ToString().Contains("普通用户"))
                {
                    this.combox_Designer.DataSource = this.table;
                    this.combox_Designer.DisplayMember = "UserFullname";
                    this.combox_Designer.ValueMember = "UserId";
                }
                else
                {
                    this.user.Show_SysUserName(this.combox_Designer);
                }
            }
            this.styleDB.Show_DesStyle(this.combox_DesStyle);
            this.load_budgetInfo(this.budgetId);
            this.t = 1;
        }

        public BudgetInfo(string bud_id, string housetype, string u)
        {
            this.components = null;
            this.typeDB = new MaterTypeDB();
            this.fromDB = new CustFromDB();
            this.designerDB = new DesignerDB();
            this.styleDB = new DesStyleDB();
            this.budgetDb = new BudgetListDB();
            this.bargainDb = new BudgetBargainDB();
            this.budgetInfoDb = new BudgetInfoDB();
            this.budgetDetailsDb = new BudgetDetailsDB();
            this.listDB = new BudgetListDB();
            this.infoDB = new BudgetInfoDB();
            this.barDB = new BudgetBargainDB();
            this.detailsDB = new BudgetDetailsDB();
            this.user = new SysUserDB();
            this.table = null;
            this.budgetId = "";
            this.user_id = "";
            this.t = 0;
            this.k = 0;
            this.InitializeComponent();
            this.budgetId = bud_id;
            this.user_id = u;
            this.table = this.user.Show_SysUser(this.user_id);
            if (this.table.Rows[0][4].ToString().Contains("普通用户"))
            {
                this.combox_Designer.DataSource = this.table;
                this.combox_Designer.DisplayMember = "UserFullname";
                this.combox_Designer.ValueMember = "UserId";
            }
            else
            {
                this.user.Show_SysUserName(this.combox_Designer);
            }
            this.styleDB.Show_DesStyle(this.combox_DesStyle);
            this.load_budgetInfo(this.budgetId);
            this.t = 2;
            this.txt_HouseType.Text = housetype;
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定要取消吗？", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    HouseTypeInfo owner = (HouseTypeInfo) base.Owner;
                    owner.save_state = 0;
                    base.Close();
                }
            }
            catch (Exception)
            {
            }
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txt_Customer_Name.Text.Trim().Equals(""))
                {
                    MessageBox.Show("请填写客户名称！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    this.txt_Customer_Name.Focus();
                }
                else
                {
                    Regex regex = new Regex(@"(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$");
                    if (this.txt_Phone.Text.Trim().Equals(""))
                    {
                        MessageBox.Show("请正确填写联系电话！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.txt_Phone.Focus();
                    }
                    else if (this.combox_Designer.Text.Trim().Equals(""))
                    {
                        MessageBox.Show("请选择设计师！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.combox_Designer.Focus();
                    }
                    else if (this.combox_DesStyle.Text.Trim().Equals(""))
                    {
                        MessageBox.Show("请选择装饰风格！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.combox_DesStyle.Focus();
                    }
                    else if (this.txt_Address.Text.Trim().Equals(""))
                    {
                        MessageBox.Show("请填写工程地址！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.txt_Address.Focus();
                    }
                    else
                    {
                        Regex regex2 = new Regex(@"^(([0-9]+\.[0-9]*[0-9][0-9]*)|([0-9]*[0-9][0-9]*\.[0-9]+)|([0-9]*[0-9][0-9]*))$");
                        if (!regex2.IsMatch(this.txt_HouseArea.Text.Trim()))
                        {
                            MessageBox.Show("请正确填写建筑面积！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            this.txt_HouseArea.Focus();
                        }
                        else if (!regex2.IsMatch(this.txt_Dingjin.Text.Trim()))
                        {
                            MessageBox.Show("请正确填写定金情况！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            this.txt_Dingjin.Focus();
                        }
                        else if (!regex2.IsMatch(this.txt_ShouFu.Text.Trim()))
                        {
                            MessageBox.Show("请正确填写首付情况！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            this.txt_ShouFu.Focus();
                        }
                        else
                        {
                            BudgetList list;
                            BudgetBargain bargain;
                            int num;
                            int num2;
                            jzgl.Model.BudgetInfo info;
                            HouseTypeInfo info2;
                            int num3;
                            BudgetDetails details;
                            if (this.t == 2)
                            {
                                list = new BudgetList();
                                list._BudListKey = key;
                                list._CustName = this.txt_Customer_Name.Text.Trim();
                                list._CustPhone = this.txt_Phone.Text.Trim();
                                list._Designer = this.combox_Designer.Text.Trim();
                                list._HourseType = this.txt_HouseType.Text.Trim();
                                list._HourseArea = float.Parse(this.txt_HouseArea.Text.Trim());
                                list._DesStyle = this.combox_DesStyle.Text.ToString().Trim();
                                list._BudgetTime = this.dateTimePicker1.Value;
                                list._DesDeposit = float.Parse(this.txt_Dingjin.Text.Trim());
                                list._CustFrom = this.txtCustomerFrom.Text.Trim();
                                list._BudAddress = this.txt_Address.Text.Trim();
                                list._BudTotal = float.Parse(this.txt_ZaoJia.Text.Trim());
                                this.table = this.user.Show_userIdBy_FullName(this.combox_Designer.Text.Trim());
                                list._BudRemark = this.table.Rows[0][1].ToString();
                                this.listDB.Add_BudgetList(list);
                                bargain = new BudgetBargain();
                                bargain._BudBarKey = key;
                                bargain._BudBarDate = this.dateTimePicker2.Value;
                                if (this.chk_QianHeTong.Checked)
                                {
                                    bargain._BudBarState = 1;
                                }
                                else
                                {
                                    bargain._BudBarState = 0;
                                }
                                bargain._BudBarNum = this.txt_BianHao.Text.Trim();
                                bargain._BudBarCard = "";
                                bargain._BudBarFirstPay = float.Parse(this.txt_ShouFu.Text.Trim());
                                bargain.BudBarTotal1 = float.Parse(this.txt_ZaoJia.Text.Trim());
                                bargain.BudBarReb = 0f;
                                bargain._BudBarStartDate = this.dateTimePicker3.Value;
                                bargain._BudBarEndDate = this.dateTimePicker4.Value;
                                bargain._BudBarIsClean = 0;
                                bargain._BudBarRemark = this.txt_YaoQiu.Text.Trim();
                                this.barDB.Add_BudgetBargain(bargain);
                                DataTable table = this.infoDB.Show_BudgetInfoBYBudgetList_Key(this.budgetId);
                                if (table.Rows.Count > 0)
                                {
                                    num = 0;
                                    for (num2 = 0; num2 < table.Rows.Count; num2++)
                                    {
                                        info = new jzgl.Model.BudgetInfo();
                                        info.BudInfoNodeId = int.Parse(table.Rows[num2][1].ToString());
                                        info._BudListKey = key;
                                        info._BudInfoName = table.Rows[num2][2].ToString();
                                        info._BudInfoPrice = float.Parse(table.Rows[num2][3].ToString().Trim());
                                        info._BudInfoRemark = "";
                                        num = this.budgetInfoDb.Add_BudgetInfo(info);
                                        info2 = (HouseTypeInfo) base.Owner;
                                        DataTable table2 = this.detailsDB.Show_BudgetDetailsYBudInfo_Id(table.Rows[num2][1].ToString(), info2.oldkey);
                                        num3 = 0;
                                        for (int i = 0; i < table2.Rows.Count; i++)
                                        {
                                            details = new BudgetDetails();
                                            details.BudInfoNodeId = int.Parse(table2.Rows[i][2].ToString().Trim());
                                            details.BudDetKey = key;
                                            details._BudDetName = table2.Rows[i][3].ToString().Trim();
                                            details._BudDetUnit = table2.Rows[i][4].ToString().Trim();
                                            details._BudDetPrice = float.Parse(table2.Rows[i][5].ToString().Trim());
                                            details._BudDetNum = int.Parse(table2.Rows[i][6].ToString().Trim());
                                            details._BudDetSum = float.Parse(table2.Rows[i][7].ToString().Trim());
                                            details._BudDetTech = table2.Rows[i][8].ToString().Trim();
                                            details._BudDetRemark = table2.Rows[i][9].ToString().Trim();
                                            num3 = this.budgetDetailsDb.Add_BudgetDetails(details);
                                        }
                                    }
                                }
                                HouseTypeInfo owner = (HouseTypeInfo) base.Owner;
                                owner.save_state = 1;
                                owner.Auto_save_budget[0] = key;
                                owner.Auto_save_budget[1] = this.combox_Designer.Text.Trim();
                                owner.Auto_save_budget[2] = this.txt_Address.Text.Trim();
                                owner.Auto_save_budget[3] = this.txt_Customer_Name.Text.Trim();
                                base.Dispose();
                            }
                            if (this.t == 1)
                            {
                                if (!regex2.IsMatch(this.txt_ZaoJia.Text.Trim()))
                                {
                                    MessageBox.Show("请正确填写合同造价！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                                }
                                else
                                {
                                    this.detailsDB.Delete_BudgetDetails(this.budgetId.Trim());
                                    this.infoDB.Delete_BudgetInfoBYBudgetList_Key(this.budgetId.Trim());
                                    this.barDB.Delete_BudgetBargainBy_budListKey(this.budgetId.Trim());
                                    this.listDB.Delete_BudgetList(this.budgetId.Trim());
                                    list = new BudgetList();
                                    list._BudListKey = key;
                                    list._CustName = this.txt_Customer_Name.Text.Trim();
                                    list._CustPhone = this.txt_Phone.Text.Trim();
                                    list._Designer = this.combox_Designer.Text.Trim();
                                    list._HourseType = this.txt_HouseType.Text.Trim();
                                    list._HourseArea = float.Parse(this.txt_HouseArea.Text.Trim());
                                    list._DesStyle = this.combox_DesStyle.Text.Trim();
                                    list._BudgetTime = this.dateTimePicker1.Value;
                                    list._DesDeposit = float.Parse(this.txt_Dingjin.Text.Trim());
                                    list._CustFrom = this.txtCustomerFrom.Text.Trim();
                                    list._BudAddress = this.txt_Address.Text.Trim();
                                    list._BudTotal = float.Parse(this.txt_ZaoJia.Text.Trim());
                                    this.table = this.user.Show_userIdBy_FullName(this.combox_Designer.Text.Trim());
                                    list._BudRemark = this.table.Rows[0][1].ToString();
                                    bargain = new BudgetBargain();
                                    bargain._BudBarKey = key;
                                    bargain._BudBarDate = this.dateTimePicker2.Value;
                                    if (this.chk_QianHeTong.Checked)
                                    {
                                        bargain._BudBarState = 1;
                                    }
                                    else
                                    {
                                        bargain._BudBarState = 0;
                                    }
                                    bargain._BudBarNum = this.txt_BianHao.Text.Trim();
                                    bargain._BudBarCard = "";
                                    bargain._BudBarFirstPay = float.Parse(this.txt_ShouFu.Text.Trim());
                                    bargain.BudBarTotal1 = float.Parse(this.txt_ZaoJia.Text.Trim());
                                    bargain.BudBarReb = 0f;
                                    bargain._BudBarStartDate = this.dateTimePicker3.Value;
                                    bargain._BudBarEndDate = this.dateTimePicker4.Value;
                                    bargain._BudBarIsClean = 0;
                                    bargain._BudBarRemark = this.txt_YaoQiu.Text.Trim();
                                    num = 0;
                                    for (num2 = 0; num2 < jzgl.Windows.BudgetInfo.list.Count; num2++)
                                    {
                                        info = new jzgl.Model.BudgetInfo();
                                        info.BudInfoNodeId = jzgl.Windows.BudgetInfo.list[num2].BudInfoNodeId;
                                        info._BudListKey = key;
                                        info._BudInfoName = jzgl.Windows.BudgetInfo.list[num2]._BudInfoName;
                                        info._BudInfoPrice = jzgl.Windows.BudgetInfo.list[num2]._BudInfoPrice;
                                        info._BudInfoRemark = "";
                                        num = this.budgetInfoDb.Add_BudgetInfo(info);
                                    }
                                    num3 = 0;
                                    if (listBudgetDetails.Count > 0)
                                    {
                                        for (num2 = 0; num2 < listBudgetDetails.Count; num2++)
                                        {
                                            details = new BudgetDetails();
                                            details.BudInfoNodeId = listBudgetDetails[num2].BudInfoNodeId;
                                            details.BudDetKey = key;
                                            details._BudDetName = listBudgetDetails[num2]._BudDetName;
                                            details._BudDetUnit = listBudgetDetails[num2]._BudDetUnit;
                                            details._BudDetPrice = listBudgetDetails[num2]._BudDetPrice;
                                            details._BudDetNum = listBudgetDetails[num2]._BudDetNum;
                                            details._BudDetSum = listBudgetDetails[num2]._BudDetSum;
                                            details._BudDetTech = listBudgetDetails[num2]._BudDetTech;
                                            num3 = this.budgetDetailsDb.Add_BudgetDetails(details);
                                        }
                                    }
                                    int num5 = this.budgetDb.Add_BudgetList(list);
                                    int num6 = this.bargainDb.Add_BudgetBargain(bargain);
                                    if ((((num5 > 0) && (num6 > 0)) && (num > 0)) && (num3 >= 0))
                                    {
                                        info2 = (HouseTypeInfo) base.Owner;
                                        info2.save_state = 1;
                                        info2.Auto_save_budget[0] = key;
                                        info2.Auto_save_budget[1] = this.combox_Designer.Text.Trim();
                                        info2.Auto_save_budget[2] = this.txt_Address.Text.Trim();
                                        info2.Auto_save_budget[3] = this.txt_Customer_Name.Text.Trim();
                                        this.k = 1;
                                        base.Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }

        private void BudgetInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
        }

        private void BudgetInfo_Load(object sender, EventArgs e)
        {
            this.dateTimePicker2.Enabled = false;
            this.dateTimePicker3.Enabled = false;
            this.dateTimePicker4.Enabled = false;
            if (this.t == 1)
            {
                HouseTypeInfo owner = (HouseTypeInfo) base.Owner;
                if (!owner.HomeType.Trim().Equals(""))
                {
                    this.txt_HouseType.Text = owner.HomeType;
                }
                this.txt_ZaoJia.Text = owner.Total.ToString();
                if (this.txt_Address.Text.Trim().Equals(""))
                {
                    key = "ID" + DateTime.Now.ToString("yyyyMMddHHmmss");
                }
                else
                {
                    key = this.budgetId;
                }
                list = owner.ListNodes;
                listBudgetDetails = owner.ListBudgetDetailNodes;
            }
            if (this.t == 2)
            {
                key = "ID" + DateTime.Now.ToString("yyyyMMddHHmmss");
            }
        }

        private void chk_QianHeTong_CheckedChanged(object sender, EventArgs e)
        {
            if (this.chk_QianHeTong.Checked)
            {
                this.dateTimePicker2.Enabled = true;
                this.dateTimePicker3.Enabled = true;
                this.dateTimePicker4.Enabled = true;
            }
            else
            {
                this.dateTimePicker2.Enabled = false;
                this.dateTimePicker3.Enabled = false;
                this.dateTimePicker4.Enabled = false;
            }
        }

        private void combox_ZheKouLv_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if ((e.KeyChar == '\b') || (e.KeyChar == '.'))
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请检查输入的数据！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.panel1 = new Panel();
            this.btn_Save = new Button();
            this.btn_Cancel = new Button();
            this.groupBox2 = new GroupBox();
            this.txt_YaoQiu = new TextBox();
            this.dateTimePicker4 = new DateTimePicker();
            this.dateTimePicker3 = new DateTimePicker();
            this.txt_ZaoJia = new TextBox();
            this.txt_ShouFu = new TextBox();
            this.label20 = new Label();
            this.txt_BianHao = new TextBox();
            this.dateTimePicker2 = new DateTimePicker();
            this.chk_QianHeTong = new CheckBox();
            this.label19 = new Label();
            this.label18 = new Label();
            this.label17 = new Label();
            this.label15 = new Label();
            this.label14 = new Label();
            this.label12 = new Label();
            this.label11 = new Label();
            this.groupBox1 = new GroupBox();
            this.txtCustomerFrom = new TextBox();
            this.txt_Address = new TextBox();
            this.txt_Dingjin = new TextBox();
            this.txt_HouseArea = new TextBox();
            this.txt_Phone = new TextBox();
            this.txt_HouseType = new TextBox();
            this.txt_Customer_Name = new TextBox();
            this.dateTimePicker1 = new DateTimePicker();
            this.combox_DesStyle = new ComboBox();
            this.combox_Designer = new ComboBox();
            this.label10 = new Label();
            this.label9 = new Label();
            this.label8 = new Label();
            this.label7 = new Label();
            this.label6 = new Label();
            this.label5 = new Label();
            this.label4 = new Label();
            this.label3 = new Label();
            this.label2 = new Label();
            this.label1 = new Label();
            this.panel1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            this.panel1.Controls.Add(this.btn_Save);
            this.panel1.Controls.Add(this.btn_Cancel);
            this.panel1.Controls.Add(this.groupBox2);
            this.panel1.Controls.Add(this.groupBox1);
            this.panel1.Dock = DockStyle.Fill;
            this.panel1.Location = new Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x240, 0x184);
            this.panel1.TabIndex = 0;
            this.panel1.Paint += new PaintEventHandler(this.panel1_Paint);
            this.btn_Save.Location = new Point(0x17b, 0x167);
            this.btn_Save.Name = "btn_Save";
            this.btn_Save.Size = new Size(0x4d, 0x17);
            this.btn_Save.TabIndex = 0;
            this.btn_Save.Text = "确定(&O)";
            this.btn_Save.UseVisualStyleBackColor = true;
            this.btn_Save.Click += new EventHandler(this.btn_Save_Click);
            this.btn_Cancel.Location = new Point(0x1ce, 0x167);
            this.btn_Cancel.Name = "btn_Cancel";
            this.btn_Cancel.Size = new Size(0x45, 0x17);
            this.btn_Cancel.TabIndex = 1;
            this.btn_Cancel.Text = "取消(&C)";
            this.btn_Cancel.UseVisualStyleBackColor = true;
            this.btn_Cancel.Click += new EventHandler(this.btn_Cancel_Click);
            this.groupBox2.Controls.Add(this.txt_YaoQiu);
            this.groupBox2.Controls.Add(this.dateTimePicker4);
            this.groupBox2.Controls.Add(this.dateTimePicker3);
            this.groupBox2.Controls.Add(this.txt_ZaoJia);
            this.groupBox2.Controls.Add(this.txt_ShouFu);
            this.groupBox2.Controls.Add(this.label20);
            this.groupBox2.Controls.Add(this.txt_BianHao);
            this.groupBox2.Controls.Add(this.dateTimePicker2);
            this.groupBox2.Controls.Add(this.chk_QianHeTong);
            this.groupBox2.Controls.Add(this.label19);
            this.groupBox2.Controls.Add(this.label18);
            this.groupBox2.Controls.Add(this.label17);
            this.groupBox2.Controls.Add(this.label15);
            this.groupBox2.Controls.Add(this.label14);
            this.groupBox2.Controls.Add(this.label12);
            this.groupBox2.Controls.Add(this.label11);
            this.groupBox2.Location = new Point(0x13, 0xa6);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new Size(0x221, 0xb0);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "合同信息";
            this.txt_YaoQiu.Location = new Point(0x3e, 0x66);
            this.txt_YaoQiu.Multiline = true;
            this.txt_YaoQiu.Name = "txt_YaoQiu";
            this.txt_YaoQiu.Size = new Size(0x1d4, 0x44);
            this.txt_YaoQiu.TabIndex = 20;
            this.dateTimePicker4.Location = new Point(0xc4, 0x49);
            this.dateTimePicker4.Name = "dateTimePicker4";
            this.dateTimePicker4.Size = new Size(0x6a, 0x15);
            this.dateTimePicker4.TabIndex = 0x13;
            this.dateTimePicker3.Location = new Point(0x3e, 0x49);
            this.dateTimePicker3.Name = "dateTimePicker3";
            this.dateTimePicker3.Size = new Size(0x6a, 0x15);
            this.dateTimePicker3.TabIndex = 0x12;
            this.txt_ZaoJia.BackColor = Color.White;
            this.txt_ZaoJia.Location = new Point(0x142, 0x2b);
            this.txt_ZaoJia.Name = "txt_ZaoJia";
            this.txt_ZaoJia.ReadOnly = true;
            this.txt_ZaoJia.Size = new Size(0x4c, 0x15);
            this.txt_ZaoJia.TabIndex = 0x10;
            this.txt_ZaoJia.Text = "0";
            this.txt_ZaoJia.TextAlign = HorizontalAlignment.Right;
            this.txt_ShouFu.Location = new Point(0x3e, 0x2b);
            this.txt_ShouFu.Name = "txt_ShouFu";
            this.txt_ShouFu.Size = new Size(0x6b, 0x15);
            this.txt_ShouFu.TabIndex = 15;
            this.txt_ShouFu.Text = "0";
            this.txt_ShouFu.TextAlign = HorizontalAlignment.Right;
            this.label20.AutoSize = true;
            this.label20.Location = new Point(3, 0x6d);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x35, 12);
            this.label20.TabIndex = 14;
            this.label20.Text = "客户特殊";
            this.txt_BianHao.Location = new Point(0x142, 15);
            this.txt_BianHao.Name = "txt_BianHao";
            this.txt_BianHao.Size = new Size(0xad, 0x15);
            this.txt_BianHao.TabIndex = 12;
            this.dateTimePicker2.Location = new Point(0x3e, 0x10);
            this.dateTimePicker2.Name = "dateTimePicker2";
            this.dateTimePicker2.Size = new Size(0x6b, 0x15);
            this.dateTimePicker2.TabIndex = 11;
            this.chk_QianHeTong.AutoSize = true;
            this.chk_QianHeTong.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.chk_QianHeTong.Location = new Point(0xab, 20);
            this.chk_QianHeTong.Name = "chk_QianHeTong";
            this.chk_QianHeTong.Size = new Size(0x48, 0x10);
            this.chk_QianHeTong.TabIndex = 9;
            this.chk_QianHeTong.Text = "已签合同";
            this.chk_QianHeTong.UseVisualStyleBackColor = true;
            this.chk_QianHeTong.CheckedChanged += new EventHandler(this.chk_QianHeTong_CheckedChanged);
            this.label19.AutoSize = true;
            this.label19.Location = new Point(15, 0x80);
            this.label19.Name = "label19";
            this.label19.Size = new Size(0x29, 12);
            this.label19.TabIndex = 8;
            this.label19.Text = "要求：";
            this.label18.AutoSize = true;
            this.label18.Location = new Point(0xae, 0x4f);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x11, 12);
            this.label18.TabIndex = 7;
            this.label18.Text = "至";
            this.label17.AutoSize = true;
            this.label17.Location = new Point(3, 0x4e);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x41, 12);
            this.label17.TabIndex = 6;
            this.label17.Text = "施工日期：";
            this.label15.AutoSize = true;
            this.label15.Location = new Point(0xfb, 0x2f);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x41, 12);
            this.label15.TabIndex = 4;
            this.label15.Text = "合同造价：";
            this.label14.AutoSize = true;
            this.label14.Location = new Point(3, 0x2f);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x41, 12);
            this.label14.TabIndex = 3;
            this.label14.Text = "首付情况：";
            this.label12.AutoSize = true;
            this.label12.Location = new Point(0xfb, 0x15);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x41, 12);
            this.label12.TabIndex = 1;
            this.label12.Text = "合同编号：";
            this.label11.AutoSize = true;
            this.label11.Location = new Point(3, 0x15);
            this.label11.Name = "label11";
            this.label11.Size = new Size(0x41, 12);
            this.label11.TabIndex = 0;
            this.label11.Text = "签约日期：";
            this.groupBox1.Controls.Add(this.txtCustomerFrom);
            this.groupBox1.Controls.Add(this.txt_Address);
            this.groupBox1.Controls.Add(this.txt_Dingjin);
            this.groupBox1.Controls.Add(this.txt_HouseArea);
            this.groupBox1.Controls.Add(this.txt_Phone);
            this.groupBox1.Controls.Add(this.txt_HouseType);
            this.groupBox1.Controls.Add(this.txt_Customer_Name);
            this.groupBox1.Controls.Add(this.dateTimePicker1);
            this.groupBox1.Controls.Add(this.combox_DesStyle);
            this.groupBox1.Controls.Add(this.combox_Designer);
            this.groupBox1.Controls.Add(this.label10);
            this.groupBox1.Controls.Add(this.label9);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Controls.Add(this.label7);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new Point(0x13, 0x13);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x221, 0x83);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "工程信息";
            this.txtCustomerFrom.Location = new Point(0x1a2, 0x47);
            this.txtCustomerFrom.Name = "txtCustomerFrom";
            this.txtCustomerFrom.Size = new Size(0x79, 0x15);
            this.txtCustomerFrom.TabIndex = 20;
            this.txt_Address.Location = new Point(80, 0x60);
            this.txt_Address.Name = "txt_Address";
            this.txt_Address.Size = new Size(0x1cb, 0x15);
            this.txt_Address.TabIndex = 0x13;
            this.txt_Dingjin.Location = new Point(0x101, 0x48);
            this.txt_Dingjin.Name = "txt_Dingjin";
            this.txt_Dingjin.Size = new Size(0x5e, 0x15);
            this.txt_Dingjin.TabIndex = 0x12;
            this.txt_Dingjin.Text = "0";
            this.txt_Dingjin.TextAlign = HorizontalAlignment.Right;
            this.txt_HouseArea.Location = new Point(0x101, 0x2e);
            this.txt_HouseArea.Name = "txt_HouseArea";
            this.txt_HouseArea.Size = new Size(0x5e, 0x15);
            this.txt_HouseArea.TabIndex = 0x11;
            this.txt_HouseArea.Text = "0";
            this.txt_HouseArea.TextAlign = HorizontalAlignment.Right;
            this.txt_Phone.Location = new Point(0x101, 20);
            this.txt_Phone.Name = "txt_Phone";
            this.txt_Phone.Size = new Size(0x5e, 0x15);
            this.txt_Phone.TabIndex = 0x10;
            this.txt_HouseType.BackColor = Color.White;
            this.txt_HouseType.Location = new Point(80, 0x2e);
            this.txt_HouseType.Name = "txt_HouseType";
            this.txt_HouseType.ReadOnly = true;
            this.txt_HouseType.Size = new Size(0x6c, 0x15);
            this.txt_HouseType.TabIndex = 15;
            this.txt_Customer_Name.Location = new Point(80, 20);
            this.txt_Customer_Name.Name = "txt_Customer_Name";
            this.txt_Customer_Name.Size = new Size(0x6c, 0x15);
            this.txt_Customer_Name.TabIndex = 14;
            this.dateTimePicker1.Location = new Point(80, 0x47);
            this.dateTimePicker1.Name = "dateTimePicker1";
            this.dateTimePicker1.Size = new Size(0x6c, 0x15);
            this.dateTimePicker1.TabIndex = 13;
            this.combox_DesStyle.DropDownStyle = ComboBoxStyle.DropDownList;
            this.combox_DesStyle.FormattingEnabled = true;
            this.combox_DesStyle.Location = new Point(0x1a2, 0x2e);
            this.combox_DesStyle.Name = "combox_DesStyle";
            this.combox_DesStyle.Size = new Size(0x5e, 20);
            this.combox_DesStyle.TabIndex = 11;
            this.combox_Designer.DropDownStyle = ComboBoxStyle.DropDownList;
            this.combox_Designer.FormattingEnabled = true;
            this.combox_Designer.Location = new Point(0x1a2, 20);
            this.combox_Designer.Name = "combox_Designer";
            this.combox_Designer.Size = new Size(0x5e, 20);
            this.combox_Designer.TabIndex = 10;
            this.label10.AutoSize = true;
            this.label10.Location = new Point(0x13, 0x66);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x41, 12);
            this.label10.TabIndex = 9;
            this.label10.Text = "工程地址：";
            this.label9.AutoSize = true;
            this.label9.Location = new Point(0x165, 0x49);
            this.label9.Name = "label9";
            this.label9.Size = new Size(0x41, 12);
            this.label9.TabIndex = 8;
            this.label9.Text = "客户来源：";
            this.label8.AutoSize = true;
            this.label8.Location = new Point(0xc6, 0x49);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x41, 12);
            this.label8.TabIndex = 7;
            this.label8.Text = "定金情况：";
            this.label7.AutoSize = true;
            this.label7.Location = new Point(0x13, 0x49);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x41, 12);
            this.label7.TabIndex = 6;
            this.label7.Text = "置房时间：";
            this.label6.AutoSize = true;
            this.label6.Location = new Point(0x165, 0x31);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x41, 12);
            this.label6.TabIndex = 5;
            this.label6.Text = "装修风格：";
            this.label5.AutoSize = true;
            this.label5.Location = new Point(0xc6, 0x31);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x41, 12);
            this.label5.TabIndex = 4;
            this.label5.Text = "建筑面积：";
            this.label4.AutoSize = true;
            this.label4.Location = new Point(0x13, 0x31);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x41, 12);
            this.label4.TabIndex = 3;
            this.label4.Text = "户    型：";
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0x165, 0x19);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x41, 12);
            this.label3.TabIndex = 2;
            this.label3.Text = "设 计 师：";
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0xc6, 0x19);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x41, 12);
            this.label2.TabIndex = 1;
            this.label2.Text = "联系电话：";
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0x13, 0x19);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x41, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "客户名称：";
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x240, 0x184);
            base.ControlBox = false;
            base.Controls.Add(this.panel1);
            base.MaximizeBox = false;
            this.MaximumSize = new Size(0x248, 420);
            base.MinimizeBox = false;
            this.MinimumSize = new Size(0x248, 420);
            base.Name = "BudgetInfo";
            this.Text = "工程信息";
            base.Load += new EventHandler(this.BudgetInfo_Load);
            base.FormClosing += new FormClosingEventHandler(this.BudgetInfo_FormClosing);
            this.panel1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            base.ResumeLayout(false);
        }

        public void load_budgetInfo(string id)
        {
            try
            {
                DataTable table = this.listDB.Show_BudgetListBy_BudlistId(id.Trim());
                if (table.Rows.Count != 0)
                {
                    this.txt_Address.Text = table.Rows[0][12].ToString();
                    this.txt_HouseArea.Text = float.Parse(table.Rows[0][7].ToString()).ToString("f2");
                    this.txt_Customer_Name.Text = table.Rows[0][2].ToString();
                    this.combox_Designer.Text = table.Rows[0][4].ToString();
                    this.txt_HouseType.Text = table.Rows[0][6].ToString();
                    this.txt_Phone.Text = table.Rows[0][3].ToString();
                    this.dateTimePicker1.Text = DateTime.Parse(table.Rows[0][10].ToString()).ToShortDateString();
                    this.combox_DesStyle.Text = table.Rows[0][8].ToString();
                    this.txtCustomerFrom.Text = table.Rows[0][11].ToString();
                    this.txt_Dingjin.Text = float.Parse(table.Rows[0][9].ToString()).ToString("f2");
                }
                DataTable table2 = this.barDB.Show_BudgetBargainBy_BudgetId(id.Trim());
                if (table2.Rows.Count != 0)
                {
                    this.txt_ShouFu.Text = float.Parse(table2.Rows[0][6].ToString()).ToString("f2");
                    this.txt_ZaoJia.Text = float.Parse(table2.Rows[0][7].ToString()).ToString("f2");
                    this.txt_BianHao.Text = table2.Rows[0][2].ToString();
                    this.txt_YaoQiu.Text = table2.Rows[0][12].ToString();
                    this.dateTimePicker3.Text = table2.Rows[0][9].ToString();
                    this.dateTimePicker4.Text = table2.Rows[0][10].ToString();
                    this.dateTimePicker2.Text = table2.Rows[0][3].ToString();
                    if (table2.Rows[0][4].ToString().Trim().Equals("1"))
                    {
                        this.chk_QianHeTong.Checked = true;
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
        }
    }
}

